package site.wetsion.employ.server.mapper;

import java.math.BigInteger;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import site.wetsion.employ.server.pojo.ForumFollow;
import site.wetsion.employ.server.pojo.ForumPost;

public interface ForumMapper {
	
	/** 插入一条帖子记录*/
	public void insertForumPost(ForumPost post) throws Exception;
	/** 插入一条回复记录*/
	public void insertForumFollow(ForumFollow post) throws Exception;
	
	/**	获取帖子列表，分页 */
	public List<ForumPost> getForumPostListByPage(int pageNum, int pageSize) throws Exception;
	/** 获取所有帖子的数量*/
	public int getCountOfForumPostList() throws Exception;
	
	/**	获取搜索帖子列表，分页 */
	public List<ForumPost> getForumPostListOnSearchByPage(
			@Param("pageNum") int pageNum, 
			@Param("pageSize") int pageSize, 
			@Param("keyword") String keyword) throws Exception;
	/** 获取搜索帖子的数量*/
	public int getCountOfSearchForumPost(@Param("keyword") String keyword) throws Exception;
	
	/** 根据id获取帖子*/
	public ForumPost getForumPostById(BigInteger id) throws Exception;
	/** 根据帖子id获取该帖子下面的回复*/
	public List<ForumFollow> getForumFollowByPostIdByPage(
			@Param("pageNum") int pageNum, 
			@Param("pageSize") int pageSize, 
			@Param("id") BigInteger id) throws Exception;
	/** 根据回复id获取回复*/
	public ForumFollow getForumFollowById(BigInteger id) throws Exception;
	/** 获取帖子的回复数量*/
	public int getCountOfForumFollowList(BigInteger id) throws Exception;
	
	/** 获取用户帖子的数量*/
	public int getPostCountOfUser(BigInteger userId) throws Exception;
	
	/** 根据用户id获取用户的帖子列表*/
	public List<ForumPost> getForumPostListByUserId(
			@Param("pageNum") int pageNum, 
			@Param("pageSize") int pageSize, 
			@Param("userId") BigInteger userId) throws Exception;
	
	/** 获取用户的所有对他的回帖消息*/
	public List<ForumFollow> getAllFollowMessageByUid(
			@Param("pageNum") int pageNum, 
			@Param("pageSize") int pageSize, 
			@Param("userId") BigInteger userId) throws Exception;
	public int getCountOfAllFollowMessageByUid(BigInteger userId) throws Exception;


	public int getCountOfUnLookFollowMessageByUid(BigInteger userId) throws Exception;

	/** 设置所有消息为已读*/
	public void setLookOfMessageByUid(BigInteger userId) throws Exception;

	public void deleteForumPostById(BigInteger postId) throws Exception;
	
}
